#include "myRecord.h"

//using namespace cv;
using namespace std;

//COSTRUTTORI

// Costruttore di default
template <typename _T> myRecord<_T>::myRecord() : _class(-1), _feature(0) {}

// Costruttore di copia
template <typename _T> myRecord<_T>::myRecord(const myRecord& record) : _class(-1), _feature(0)
{
	_class = record._class;
	_feature = record._feature;

}

/*template <typename _T> myRecord<_T>::myRecord(const Mat_<_T> &Record, int classe)
{
	_feature = vector<_T>(Record.rows*Record.cols);
	for(int r=0; r < Record.rows; r++)
			for(int c=0; c < Record.cols; c++)
				_feature[r+c] = Record(r,c);
	
	_class = classe;
}*/

// Operatore di assegnamento
template <typename _T> myRecord<_T>& myRecord<_T>::operator= (const myRecord& record)
{
	_class = record._class;
	_feature = record._feature;
	return *this;
}

//FINE COSTRUTTORI


//Numero delle feature del record
template <typename _T> int myRecord<_T>::size()
{
	return _feature.size();
}

template <typename _T> void myRecord<_T>::addFeature(_T feature)
{
	_feature.push_back(feature);
}

template <typename _T> _T myRecord<_T>::getFeature(int position)
{
	if(position >= 0 && position < size())
		return _feature[position];
	else
		return -1;
}

template <typename _T> void myRecord<_T>::setFeatureVector(vector<_T> feature)
{
	_feature = feature;
}

template <typename _T> vector<_T> myRecord<_T>::getFeatureVector()
{
	return _feature; 
}


template <typename _T> void myRecord<_T>::setClass(int classe)
{
	_class = classe;
}

template <typename _T> int myRecord<_T>::getClass()
{
	return _class;
}

template class myRecord<float>;
template class myRecord<int>;